package com.vo;

import com.bean.dangBean.Employee;

import java.io.Serializable;

/**
 * View Object实体: 用户
 */
public class EmployeeVo implements Serializable {
    /** 用户编号 */
    private String id;
    /** 用户账号 */
    private String userName;
    /** 用户密码 */
    private String password;
    /** 用户姓名 */
    private String realName;
    /** 用户性别 */
    private String sex;
    /** 用户生日 */
    private String roleId;
    /** 用户电话 */
    private String salary;

    public EmployeeVo() {
    }

    public EmployeeVo(String id, String userName, String password, String realName, String gender, String birthday, String phone, String address, String roleId) {
        this.id = id;
        this.userName = userName;
        this.password = password;
        this.realName = realName;
        this.sex = sex;
        this.roleId = roleId;
        this.salary = salary;
    }

    public Employee parse(){

        Employee user = new Employee();

        try {
            user.setId(Integer.valueOf(this.id));
        } catch (Exception e) {
//            e.printStackTrace();
        }
        try {
            user.setSex(Integer.valueOf(this.sex));
        } catch (Exception e) {
//            e.printStackTrace();
        }
        try {
            user.setRoleId(Integer.valueOf(this.sex));
        } catch (Exception e) {
//            e.printStackTrace();
        }

        user.setUserName(this.userName);
        user.setPassword(this.password);
        user.setRealName(this.realName);
        user.setSalary(this.salary);

        return user;
    }

    @Override
    public String toString() {
        return "EmployeeVo{" +
                "id='" + id + '\'' +
                ", userName='" + userName + '\'' +
                ", password='" + password + '\'' +
                ", realName='" + realName + '\'' +
                ", sex='" + sex + '\'' +
                ", roleId='" + roleId + '\'' +
                ", salary='" + salary + '\'' +
                '}';
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getRealName() {
        return realName;
    }

    public void setRealName(String realName) {
        this.realName = realName;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getRoleId() {
        return roleId;
    }

    public void setRoleId(String roleId) {
        this.roleId = roleId;
    }

    public String getSalary() {
        return salary;
    }

    public void setSalary(String salary) {
        this.salary = salary;
    }
}
